package com.tenbent.product.center.user.bo;

import com.tenbent.product.base.bo.BizObject;
import com.tenbent.product.base.mybatis.annotations.TypeAlias;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by ThinkPad on 2017/9/1.
 */
@Entity
@Table(name = "pc_user_role")
@TypeAlias("userRole")
public class UserRole extends BizObject {

	@Column(name = "user_id")
	private Integer userId;

	@Column(name = "role_id")
	private Integer roleId;

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Integer getRoleId() {
		return roleId;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		UserRole userRole = (UserRole) o;

		if (userId != null ? !userId.equals(userRole.userId) : userRole.userId != null)
			return false;
		return roleId != null ? roleId.equals(userRole.roleId) : userRole.roleId == null;

	}

	@Override
	public int hashCode() {
		int result = userId != null ? userId.hashCode() : 0;
		result = 31 * result + (roleId != null ? roleId.hashCode() : 0);
		return result;
	}

	@Override
	public String toString() {
		return "UserRole{" + "userId=" + userId + ", roleId=" + roleId + '}';
	}
}
